﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;

namespace monitor_client
{
    public partial class ServerAddressForm : Form
    {
        fstart d;

        public static IPAddress ServerIP { get; set; }

        public ServerAddressForm(fstart sender)
        {
            InitializeComponent();
            d = sender;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            IPAddress ip;
            if (IPAddress.TryParse(textBox1.Text, out ip))
            {
                File.WriteAllText(@"resources\server", /*textBox1.Text*/ip.ToString());
                d();
                ServerIP = ip;
                this.Close();
            }
            else
                MessageBox.Show("Введен некорректный адрес.");
        }
    }
}
